fix 2 problems plus add workaround for #13760 #14252
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
replaces #14241
These changes fix 2 problems, and add a workaround for #13760.
MainGenericRunner
, when running from a compiled jar.-save
option is not specified at runtime, execution should not be from a previously compiled jarThe
-save
behavior matches the expectation inscala2
.This PR displays all exceptions on the Console when running from a
jar
file.This PR executes from the
jar
only if the-save
option is specified at runtime. Problem scripts (i.e., with references tojava.sql.Date
) can now selectively disable the -save option.The
-save
option change provides a workaround for theClassNotFound: java.sql.Date
problem, which affects jdk 9+.A new command line option
-nosave
is provided, for undoing a-save
option on the command line (e.g., inSCALA_OPTS
) This provides a way for individual scripts to override the-save
option.Adding
-save
toSCALA_OPTS
will typically reduce script startup time by a couple of seconds. This PR provides per-script granularity for overriding the '-save' option. Scripts that would otherwise throw an exception when running from a compiled jar may specify-nosave
in the hashbang line. This avoids having to remove the-save
option fromSCALA_OPTS
.The
-nosave
option can be added to the hashbang line, as in these two example hashbang lines:The first version requires
/usr/bin/env
version8.30
or later:#!/usr/bin/env -S scala -nosave
This version uses the path to the scala wrapper:
#!/opt/scala3/bin/scala -nosave